package com.shujia.common

import java.text.SimpleDateFormat

object DateUtil {
  def diff_date(date_str1: String, date_str2: String): Long = {
    val f1 = new SimpleDateFormat("yyyyMMddHHmmss")
    val t1: Long = f1.parse(date_str1).getTime
    val t2: Long = f1.parse(date_str2).getTime
    Math.abs(t1 - t2) / 1000
  }

  def main(args: Array[String]): Unit = {
    println(DateUtil.diff_date("20180503193247", "20180503192547"))
  }
}
